package cn.kgc.userservice.controller;

import cn.kgc.librarycommon.pojo.User;
import cn.kgc.userservice.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/users")
@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/isRepeat")
    public Integer isRepeat(String userName){
        return userService.isRepeat(userName);
    }

    @PostMapping("/addUser")
    public Integer addUser(@RequestBody User user){
        return userService.addUser(user);
    }

    @GetMapping("/login")
    public User login(String username){
        return userService.login(username);
    }
}
